<template>
  <!-- 列表 -->
  <ContentWrap>
    <el-table
      row-key="id"
      v-loading="loading"
      :data="list"
      :stripe="true"
      :show-overflow-tooltip="true"
    >
      <el-table-column label="序号" type="index" width="100" />
      <el-table-column label="姓名" prop="nickname" >
      	<template #default="scope">
      	  {{scope.row.userSimpleRespVO?.nickname}}
      	</template>
      </el-table-column>
      <el-table-column label="部门" prop="deptName" >
      	<template #default="scope">
      	  {{scope.row.userSimpleRespVO?.deptName}}
      	</template>
      </el-table-column>
      <el-table-column
        label="创建时间"
        align="center"
        prop="createTime"
        :formatter="dateFormatter"
        width="180px"
      />
    </el-table>
  </ContentWrap>
</template>
<script setup lang="ts">
import { dateFormatter } from '@/utils/formatTime'
import { ReportingTagUserApi } from '@/api/system/reportingtaguser/index'

const props = defineProps<{
  tagId?: number // 标签id（主表的关联字段）
}>()
const loading = ref(false) // 列表的加载中
const list = ref([]) // 列表的数据

/** 查询列表 */
const getList = async () => {
  loading.value = true
  try {
    list.value = await ReportingTagUserApi.list({
			pageNo: 1,
			pageSize: 100,
			tagId: props.tagId}
			)
  } finally {
    loading.value = false
  }
}

/** 初始化 **/
onMounted(() => {
  getList()
})
</script>
